import unittest
import requests
import os, sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, parentdir)
from fixture import db,user
from interface.get_verify_code_test import VerifyCodeTest

class RegisterTest(unittest.TestCase):
    mobile = '13651020524'
    password = '123abc'

    def setUp(self):
        self.base_url = "http://192.168.1.141:8001/register"

    # def tearDown(self):
    #     print(self.result)

    def register_test(self):
        ''' 所有参数为空 '''
        verify_code = user.get_verify_code(self.mobile)
        payload = {'mobile': self.mobile, 'verify_code':verify_code , 'password': self.password}
        r = requests.post(self.base_url, data=payload)
        self.result = r.json()
        self.assertEqual(self.result['status_code'], 200)






if __name__ == '__main__':
    #test_data.init_data() # 初始化接口测试数据
    unittest.main()